//
//  CheckGoodsInforTableViewHeaderFooterView.m
//  GLGW_Shoping
//
//  Created by yang on 2018/12/21.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "CheckGoodsInforTableViewHeaderFooterView.h"

@implementation CheckGoodsInforTableViewHeaderFooterView{
    GLGWLabel * leftLabel;
}

-(instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithReuseIdentifier:reuseIdentifier]) {
        GLGWView * topView = [[GLGWView alloc] initWithInSuperView:self.contentView];
        topView.backgroundColor = [UIColor colorWithHexString:@"#F2F2F2"];
        [topView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.top.right.equalTo(self.contentView);
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(10)));
        }];
        //
        leftLabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(16) theColor:kColor_Rule_Yellow inSuperView:self.contentView];
        [leftLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView.mas_left).offset(kWidthProportion_In_iPhoneTriploid(15));
            make.top.equalTo(topView.mas_bottom).offset(kHeightProportion_In_iPhoneTriploid(9));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(22)));
        }];
        //
        GLGWView * lineView = [[GLGWView alloc] initWithInSuperView:self.contentView];
        lineView.backgroundColor = [UIColor colorWithHexString:@"#EAEAEA"];
        [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.bottom.right.equalTo(self.contentView);
            make.height.equalTo(@1);
        }];
    }
    return self;
}

-(void)setS_headerModel:(ShopCarModel_Header *)s_headerModel{
    _s_headerModel = s_headerModel;
    CGRect rectr = CGRectZero;
    if ([_s_headerModel.titleImageStr isEqualToString:@"icon_jisujiaoyi"]) {
        rectr = CGRectMake(0, -4.5, kWidthProportion_In_iPhoneTriploid(20), kHeightProportion_In_iPhoneTriploid(20));
        leftLabel.textColor = kColor_Rule_Yellow;
    }else if ([_s_headerModel.titleImageStr isEqualToString:@"icon_changqiqiugou"]){
        rectr = CGRectMake(0, -5, kWidthProportion_In_iPhoneTriploid(18), kHeightProportion_In_iPhoneTriploid(20));
        leftLabel.textColor = kColor_Rule_Yellow;
    }else{
        rectr = CGRectMake(0, -1.5, kWidthProportion_In_iPhoneTriploid(20), kHeightProportion_In_iPhoneTriploid(15));
        leftLabel.textColor = [UIColor colorWithHexString:@"#999999"];
    }
    leftLabel.attributedText = [GLGWLabel addImageName:_s_headerModel.titleImageStr theImageFram:rectr theTextString:_s_headerModel.titleStr atImageIndex:0];
}

@end
